package com.ambulance.project.biz.controller.websocket;

import com.ambulance.project.manager.utils.DoctorAndNurseCommonUtil;
import com.ambulance.project.websockt.WebSocketServer;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @Author RXL
 * @Date 2020/6/17 15:26
 * @Version 1.0
 */
@Api(tags = {"socket-相关接口"})
@RestController
@RequestMapping(value = "/socket/v1/treat", method = RequestMethod.POST)
public class WebSocketServerController {

    @Autowired
    private WebSocketServer webSocketServer;
    @Autowired
    private DoctorAndNurseCommonUtil padCommonUtil;
    @RequestMapping(value = "padToCall")
    @ResponseBody
    @ApiOperation(value = "pad发起会诊-弃用", notes = "Pad-发起会诊", produces = "application/json")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "id", value = "值", required = true, paramType = "form", dataType = "int"),
    })
    // Pad发起呼叫通知到端
    public void PadCall(@RequestParam(value = "id") Integer id){
        // 要求登录者连接socket时ident使用自己的登录账号(保证不会重复连接同一个socket)
//        Dispatch dispatch = padCommonUtil.getDispatch();
//        Map<String, String> map = new HashMap<String, String>();
//        map.put("dispatchID",dispatch.getDispatchID().toString());
////        map.put("");
//        try {
//            webSocketServer.sendInfo("1",id.toString());
//        } catch (IOException e) {
//            e.printStackTrace();
//        }

    }
}
